package com.gm.tools;

/**
 * Created by Mouse on 2017/8/9.
 */
public class Gen {

    public static double toDouble(double base, double rang) {
        double offset = rang / 2d;
        return base - offset + Math.random() * rang;
    }

    public static double[] toDoubles(int count, double base, double rang) {
        double[] d = new double[count];
        for (int i = 0; i < d.length; i++) {
            d[i] = toDouble(base, rang);
        }
        return d;
    }

}
